package com.code2roc.locals3;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;

import javax.servlet.MultipartConfigElement;

@SpringBootApplication
public class LocalS3Application {
    public static void main(String[] args) {
        SpringApplication.run(LocalS3Application.class, args);
    }

    @Value("${spring.http.mult1ipart.max-file-size}")
    private String maxfilesize;
    @Value("${spring.http.mult1ipart.max-request-size}")
    private String maxrequestsize;
    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        //  单个数据大小
        factory.setMaxFileSize(maxfilesize); // KB,MB
        /// 总上传数据大小
        factory.setMaxRequestSize(maxrequestsize);
        return factory.createMultipartConfig();
    }
}
